package com.kwin.idempotent;

import com.kwin.idempotent.aspect.IdempotentAspect;
import com.kwin.idempotent.expression.KeyResolver;
import com.kwin.idempotent.expression.SpelExpressionKeyResolver;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author kwin
 * @Date 2022/3/24 15:40
 **/
@Configuration
public class IdempontentConfiguration {

    @Bean
    public IdempotentAspect idempotentAspect() {
        return new IdempotentAspect();
    }

    @Bean
    @ConditionalOnMissingBean
    public KeyResolver keyResolver() {
        return new SpelExpressionKeyResolver();
    }
}
